package cn.wolfcode.consumer._01_hello;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;

import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;


/**
 *   1.使用注解@Component将这个交给spring管理
 *   2.使用注解@RocketMQMessageListener,进行相关配置 topic consumerGroup 等
 *   3.这个类实现接口RocketMQListener 泛型为消息的类型
 *   4.覆写其中的onMessage方法,对消息具体处理
 */
@Component
@RocketMQMessageListener(
        topic = "hello",
        consumerGroup = "boot-hello"
)
public class HelloConsumer implements RocketMQListener<String> {

    @Override
    public void onMessage(String message) {
        System.out.println("消息的内容为:" + message);
    }
}
